home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000135_icon-group-sender _Mon Jun 7 21:49:33 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
2KB
Received: from owl.CS.Arizona.EDU by cheltenham.CS.Arizona.EDU; Mon, 14 Jun 1993 09:36:26 MST
Received: by owl.cs.arizona.edu; Mon, 14 Jun 1993 09:36:25 MST
Date: 7 Jun 93 21:49:33 GMT
From: agate!howland.reston.ans.net!math.ohio-state.edu!caen!msuinfo!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz)
Organization: University of Chicago
Subject: Re: Pattern-Matching Help Request
Message-Id: <1993Jun7.214933.25646@midway.uchicago.edu>
References: <1993Jun7.174910.21523@wariat.org>
Sender: icon-group-request@cs.arizona.edu
To: icon-group@cs.arizona.edu
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
ppetto@wariat.org (Peter J. Petto) writes:
>
>I'm looking for something that will test a string for a pattern
>analgous to the following regular expression:
>
> %From [A-Za-z0-9.]\@
You probably mean:
%From [A-Za-z0-9.]*@
Somewhere you should say namechars := &letters ++ &digits ++ '.' so you
can use this identifier the same as you would [A-Za-z0-9]. The key is that
tab(many(x)) in Icon is the standard idiom for "move forward from the cur-
rent position up to the first character not in x." The next matching func-
tion then picks up where tab(many(x)) leaves off:
if line ? (="%From ", tab(many(namechars)), ="@")
then...
Icon's string scanning functions are a bit more verbose than regular expres-
sions, for better or for worse - but far more powerful. Conversion is always
trivial once you get the hang of things. Icon sacrifices terseness and some
speed for power, elegance, and consistency with the rest of the language.
But I guess this is turning into a commentary on the relative merits of var-
ious string-matching (sub-)languages.
>I'd appreciate any and all assistance. Thanks.
Hope I helped.
--
-Richard L. Goerwitz goer%midway@uchicago.bitnet
goer@midway.uchicago.edu rutgers!oddjob!ellis!goer